home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / StandardGetFolder 1.0 Source / Bullseye Get Folder source / bullWindow.c < prev    next >
Text File  |  1991-04-25  |  953b  |  58 lines

  1. /*****
  2.  * bullWindow.c
  3.  *
  4.  *        The window routines for the Bullseye demo
  5.  *
  6.  *****/
  7.  
  8. #include "bullWindow.h"
  9.  
  10. WindowPtr    bullseyeWindow;
  11. Rect        dragRect;
  12. Rect        windowBounds = { 40, 40, 150, 150 };
  13. Rect        circleStart = {10, 10, 100, 100};
  14. int            width = 5;
  15.  
  16. /****
  17.  * SetUpWindow()
  18.  *
  19.  *    Create the Bullseye window, and open it.
  20.  *
  21.  ****/
  22.  
  23. void SetUpWindow(void)
  24.  
  25. {
  26.     dragRect = screenBits.bounds;
  27.     
  28.     bullseyeWindow = NewWindow(0L, &windowBounds, "\pBullseye", true, noGrowDocProc, (WindowPtr) -1L, true, 0);
  29.     SetPort(bullseyeWindow);
  30. }
  31. /* end SetUpWindow */
  32.  
  33.  
  34. /*****
  35.  * DrawBullseye()
  36.  *
  37.  *    Draws the bullseye.
  38.  *
  39.  *****/
  40.  
  41. void DrawBullseye(short active)
  42.  
  43. {
  44.     Rect    myRect;
  45.     int        color = true;
  46.     
  47.     SetPort(bullseyeWindow);
  48.     EraseRect(&circleStart);
  49.     myRect = circleStart;
  50.     
  51.     while(myRect.left < myRect.right)
  52.       {
  53.       FillOval(&myRect, color ? (active ? black : gray) : white);
  54.       InsetRect(&myRect, width, width);
  55.       color = !color;
  56.       } 
  57. }
  58. /* end DrawBullseye */